import uuid

from sqlalchemy import (
    Column,
    String,
    Integer,
    DateTime,
    PrimaryKeyConstraint,
    Boolean,
    text, Index
)
from internal.extension.extension_db import db
from internal.entitry.tickets_entitry import TicketsCardType, TicketsStstaus

class TourGuide(db.Model):
    __tablename__ = 'tour_guide'
    __table_args__ = (
        PrimaryKeyConstraint('id', name='ttour_guide_id_pkey'),
    )
    id = Column(String(36), nullable=False, default=lambda: str(uuid.uuid4()))
    deleted = Column(Boolean, nullable=False, default=False)
    bash_id = Column(String(36), nullable=False)  # 批次id
    user_id = Column(String(36), nullable=True) #用户id
    tour_guide_name = Column(String(20), nullable=False)  # 导游名称
    card_type = Column(String(36), nullable=False, default=TicketsCardType.ID_CARD.value)
    card_number = Column(String(50), nullable=False)  # 居民身份证号码
    travel_agency_card_num = Column(String(50), nullable=False)  # 导游身份证号码
    travel_agency_phone = Column(String(30), nullable=False)  # 导游手机号
    enabled = Column(Integer, nullable=False, default=1)
    status = Column(String(20), nullable=False, default=TicketsStstaus.PADDING.value)  # 0初始状态，1预约成功，2提交成功，-1失败
    updated_at = Column(
        DateTime,
        nullable=False,
        server_default=text("CURRENT_TIMESTAMP(0)"),
        server_onupdate=text("CURRENT_TIMESTAMP(0)"),
    )
    created_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP(0)"))